package com.le.tester.javaThink.fifth.chapter24_ConcurrentProgramming;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * createTime：2021/8/18 11:11
 * description：LambdasAndMethodReferences
 */

class NotRunnable {
    public void go() {
        System.out.println("NotRunnable");
    }
}

class NotCallable {
    public Integer get() {
        System.out.println("NotCallable");
        return 1;
    }
}

public class LambdasAndMethodReferences {
    public static void main(String[] args) {
        ExecutorService service = Executors.newCachedThreadPool();

        service.submit(() -> System.out.println("Lambda1"));
        service.submit(new NotRunnable()::go);
        service.submit(() -> {
            System.out.println("lambda2");
            return 1;
        });
        service.submit(new NotCallable()::get);
        service.shutdown();


    }
}
